package com.sskj.finance.presenter;

import com.lzy.okrx2.adapter.FlowableBody;
import com.sskj.common.base.HttpData;
import com.sskj.finance.bean.AssetBean;
import com.sskj.finance.ui.activity.DetailActivity;
import com.sskj.lib.bean.PageBean;
import com.sskj.lib.http.JsonConverter;

import java.util.ArrayList;
import java.util.List;

import io.reactivex.Flowable;


public class DetailActivityPresenter extends BasePresenter<DetailActivity> {

    public Flowable<List<AssetBean>>  getData(String pid,String type,String p,String size){
       return httpService.getAssetRecord(pid,type, p, size)
                .converter(new JsonConverter<HttpData<PageBean<AssetBean>>>() {
                })
                .adapt(new FlowableBody<>())
                .map(pageBeanHttpData -> pageBeanHttpData.getData().getList())
                .onErrorReturnItem(new ArrayList<>());
    }
}
